[1] "/Users/czmann/Documents/teaching/stat331/stat331-calpoly-s25/slides/week-1"
Today we will…
[1] "/Users/czmann/Documents/teaching/stat331/stat331-calpoly-s25/slides/week-1"
This file lives in my user files Users/…
…on my account czmann/ …
…in my Documents folder …
…in a series of organized folders.
Your working directory is the folder that R “thinks” it lives in at the moment.
In computing: analyses can be executed again with identical results (either by you or by someone else!)
Why does it matter?
You can to send your code to someone else, and they can jump in and start working right away.
This means:
Opens RStudio
Sets the working directory to be wherever the .Rproj file lives.
Links to GitHub, if set up (more on that later!)
RStudio Projects are great for reproducibility!
You can send anyone your folder with your .Rproj file and they will be able to run your code on their computer.
We will be using RStudio Projects throughout this course.
/User/czmann/Stat331/lab1/ rather than Desktop/stuff/If you put something like this at the top of your .qmd file (more on Quarto later), I will set your computer on fire:
This is called an “absolute file path”
That directory is specific to you!
File > New File > R Script) are files of code that are meant to be run on their own.Scripts can be run in RStudio by clicking the Run button at the top of the editor window when the script is open.
You can also run code interactively in a script by:
highlighting lines of code and hitting run.
placing your cursor on a line of code and hitting run.
placing your cursor on a line of code and hitting ctrl + enter or command + enter.
Notebooks are an implementation of literate programming.
They allow you to integrate code, output, text, images, etc. into a single document.
E.g.,
Reproducibility!
Markdown (without the “R”) is a markup language.
It uses special symbols and formatting to make pretty documents.
Markdown files have the .md extension.
R Markdown (with the “R”) uses regular Markdown, AND it can run and display R code.
Quarto unifies and extends the R Markdown ecosystem.
Quarto is the next generation R Markdown.
Consistent implementation of attractive and handy features across outputs:
More accessible defaults and better support for accessibility.
Guardrails that are helpful when learning:
Support for other languages like Python, Julia, Observable, and more.
Quarto makes moving between outputs straightforward.
A few useful tips for formatting the Markdown text in your document:
R code chunk options are included at the top of each code chunk, prefaced with a #| (hashpipe).
To take your .qmd file and make it look pretty, you have to render it.
Quarto CLI (command line interface) orchestrates each step of rendering:
knitr or jupyter.When you click Render: